const gulp = require("gulp");
const sass = require("gulp-sass");
const connect = require("gulp-connect");
const sourcemaps = require("gulp-sourcemaps");

gulp.task("sass",function(){
	gulp.src("*.scss")
	.pipe(sourcemaps.init())
	.pipe(sass({"outputStyle":"compact"}))
	.pipe(sourcemaps.write())
	.pipe(gulp.dest("dist"));
}); 
gulp.task("Fonts",function(){
	gulp.src("fonts/**")
	.pipe(gulp.dest("dist/fonts"))
});
gulp.task("css",function(){
	gulp.src("css/**")
	.pipe(gulp.dest("dist/css"))
});
gulp.task("Images",function(){
	gulp.src("images/**")
	.pipe(gulp.dest("dist/images"))
})
gulp.task("	JS",function(){
	gulp.src("js/**")
	.pipe(gulp.dest("dist/images"))
})
gulp.task("watch",function(){
	gulp.watch("*.scss",["sass"]);
	gulp.watch("fonts/**",["Fonts"]);
	gulp.watch("images/**",["Images"]);
	gulp.watch("login.html",["copy-index"]);
	gulp.watch("register.html",["zhuce"]);
	gulp.watch("index.html",["shouye"]);
	gulp.watch("favicon.ico",["favicon"]);
	gulp.watch("cart.html",["cart"]);
	gulp.watch("detail.html",["detail"]);
});
gulp.task("server",function(){
	connect.server({
		root:"dist"
	})
});
gulp.task("copy-index",function(){
	gulp.src("login.html")
	.pipe(gulp.dest("dist"));
});
gulp.task("shouye",function(){
	gulp.src("index.html")
	.pipe(gulp.dest("dist"));
});
gulp.task("zhuce",function(){
	gulp.src("register.html")
	.pipe(gulp.dest("dist"));
});
gulp.task("cart",function(){
	gulp.src("cart.html")
	.pipe(gulp.dest("dist"));
});
gulp.task("detail",function(){
	gulp.src("detail.html")
	.pipe(gulp.dest("dist"));
});
gulp.task("favicon",function(){
	gulp.src("favicon.ico")
	.pipe(gulp.dest("dist"));
})


